package com.cnswhy.cloud.server.app.feign.fallback;

import com.cnswhy.cloud.common.core.entity.constant.CnswhyServerConstant;
import com.cnswhy.cloud.server.app.feign.ISystemUserService;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import com.cnswhy.cloud.common.core.base.R;

@Slf4j
@Component
public class SystemUserServiceFallback implements FallbackFactory<ISystemUserService> {
    @Override
    public ISystemUserService create(Throwable throwable) {
        return (username,password,merchantId) -> {
            log.error("调用" + CnswhyServerConstant.CNSWHY_SERVER_SYSTEM + "服务出错", throwable);
            return R.fail("调用" + CnswhyServerConstant.CNSWHY_SERVER_SYSTEM + "服务出错");
        };
    }
}